﻿<%@ Page Title="Quản lý hãng xe" MasterPageFile="~/Admin/Site.Master" Language="C#" AutoEventWireup="true" CodeBehind="QLHangXe.aspx.cs" Inherits="Transport.Admin.QLHangXe" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<% 
    if (Session["loainguoidung"] == null)
    {
        Response.Redirect("../Default.aspx");
    }
    else
    {
        if (Session["loainguoidung"].ToString() != "ADMIN")
            Response.Redirect("Default.aspx");
    }  
    %>
<p>
    <b>Mã hãng xe:</b>
    <asp:TextBox ID="txt_ID" runat="server"></asp:TextBox>
    <b>Tên hãng xe:</b>
    <asp:TextBox ID="txt_Name" runat="server"></asp:TextBox>
    <asp:Button ID="btn_Search" runat="server" Text="Tìm" />
</p>
<p>
<asp:GridView ID="GridView_Hang" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ma_hang_xe" CellSpacing="4"
        DataSourceID="EntityDataSource_Hang" ForeColor="#333333" GridLines="None">
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
        <asp:BoundField DataField="ma_hang_xe" HeaderText="Mã hãng xe" ReadOnly="True" 
            SortExpression="ma_hang_xe" />
        <asp:BoundField DataField="ten_hang_xe" HeaderText="Tên hãng xe" 
            SortExpression="ten_hang_xe" />
    </Columns>
    <FooterStyle BackColor="#7FB308" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#7FB308" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
    <SortedAscendingCellStyle BackColor="#FDF5AC" />
    <SortedAscendingHeaderStyle BackColor="#4D0000" />
    <SortedDescendingCellStyle BackColor="#FCF6C0" />
    <SortedDescendingHeaderStyle BackColor="#820000" />
    </asp:GridView>
    <asp:EntityDataSource ID="EntityDataSource_Hang" runat="server" 
        ConnectionString="name=transportEntities" 
        DefaultContainerName="transportEntities" EnableDelete="True" 
        EnableFlattening="False" EnableInsert="True" EnableUpdate="True" 
        EntitySetName="hang_xe">
    </asp:EntityDataSource>
    <asp:QueryExtender ID="qeSearch" runat="server" TargetControlID="EntityDataSource_Hang">
        <asp:SearchExpression DataFields="ma_hang_xe" SearchType="Contains">
            <asp:ControlParameter ControlID="txt_ID" />
        </asp:SearchExpression>
        <asp:SearchExpression DataFields="ten_hang_xe" SearchType="Contains">
            <asp:ControlParameter ControlID="txt_Name" />
        </asp:SearchExpression>
        <asp:OrderByExpression DataField="ma_hang_xe" Direction="Ascending" />
    </asp:QueryExtender>
</p>
<p>
    <asp:DetailsView ID="DetailsView_Hang" runat="server" Height="50px" 
        Width="125px" AutoGenerateRows="False" BackColor="White" BorderColor="#CCCCCC" 
        BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="ma_hang_xe" 
        DataSourceID="EntityDataSource_Hang" DefaultMode="Insert" 
        ForeColor="Black" FieldHeaderStyle-Wrap="false"
        GridLines="Horizontal" oniteminserted="DetailsView_Hang_ItemInserted">
        <EditRowStyle BackColor="#7FB308" Font-Bold="True" ForeColor="White" />
        <Fields>
            <asp:BoundField DataField="ma_hang_xe" HeaderText="Mã hãng xe" ReadOnly="True" 
                SortExpression="ma_hang_xe" />
            <asp:BoundField DataField="ten_hang_xe" HeaderText="Tên hãng xe" 
                SortExpression="ten_hang_xe" />
            <asp:CommandField ShowInsertButton="True" />
        </Fields>
        <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
        <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
    </asp:DetailsView>
</p>
</asp:Content>